/**
 * Created by QianQi on 2016/6/1.
 */
$(function(){
    var listEl=$('.lpwxList');
    listEl.on('tap.view','.lpwxItem',function(){// 跳转到详情页
        location.href='06_info.html?id='+$(this).attr('data-id');
    });
    $.fn.request({
        drawDomFn:drawList
        ,showloading:true
        ,ajaxOpts:{
            url:'../_json/data.json'
            ,data:{}
        }
    });
    /* 方法定义 */
    function drawList(dl){
        var str='';
        for(var i= 0,item,len=dl.length;i<len;i++){
            item=dl[i];
            str+='<div class="lpwxItem" data-id="'+item['id']+'">';
            str+='<div class="lpwxItem-t">' +
                '<div class="lpwxItem-no">基金编号：'+item['id']+'</div>' +
                '<div class="lpwxItem-title">'+item['name']+'</div>' +
                '</div>';
            str+='<div class="lpwxItem-c">';
            str+='<table class="datatable" cellpadding="0">' +
                '<tbody><tr>' +
                '<td class="t_yellow">'+item['num']+'</td>' +
                '<td class="t_red">'+item['num']+'</td>' +
                '<td class="t_blue">'+item['num']+'</td>' +
                '<td class="t_green">'+item['num']+'</td>' +
                '</tr><tr>' +
                '<th>币种</th><th>状态</th><th>基金类型</th><th>基金期限</th>' +
                '</tr></tbody>' +
                '</table>';
            str+='<table class="infotable">' +
                '<colgroup><col style="width:100px;" /><col /></colgroup>' +
                '<tbody><tr>' +
                '<th class="th-folder">投资项目：</th>' +
                '<td>'+item['name']+'</td>' +
                '</tr><tr>' +
                '<th class="th-dollar">已投金额：</th>' +
                '<td>'+item['num']+'</td>' +
                '</tr><tr>' +
                '<th class="th-building">管理公司：</th>' +
                '<td>'+item['num']+'</td>' +
                '</tr></tbody>' +
                '</table>';
            str+='</div></div>';
        }
        if(!str) str='<div class="lpwxTips"><span>未查询到数据!</span></div>';
        listEl.html(str);
    }
});